#include "tree.h"
#include <iostream>
#include <string>

using namespace std;

int  main()
{
    string str;
    char *p;
    int length, i;
    BinaryTree BiTree;

    cout<<"请输入前序表达式序列: -+*a##b##c##*a##+b##c##\n";
    cout <<"(其中#号表示空叶子节点，需要和表达式的数字一致)\n"; 
    //cin >>str;
    str ="-+*a##b##c##*a##+b##c##";
    p = &str[0];
    i = 0;

    BiTree.create(BiTree.root, p); 

    //校验根结点右子树的右枝
    BinaryTreeNode *tmpPointer = BiTree.root;
   
    cout <<"输出树的图形(逆时针旋转了90度):\n"; 
    BiTree.treeprint(BiTree.root, 0);

    //中序遍历
    cout <<"叶子结点总数为:";

    cout <<BiTree.countLeaves();

    cout<< "\n树的层数为:" << BiTree.getLevel(BiTree.root);

    return 0;
}
